//
//  VCEditVideoViewController.m
//  VideoCollage
//
//  Created by Mac on 2018/6/29.
//  Copyright © 2018年 stoneobs.qq.com. All rights reserved.
//

#import "VCEditVideoViewController.h"
@interface VCEditVideoViewController()<UIVideoEditorControllerDelegate,UINavigationControllerDelegate>

@end
@implementation VCEditVideoViewController
- (instancetype)initWithFromVC:(UIViewController*)fromVC localPath:(NSString *)localPath{
    if (self == [super init]) {
        _fromVC = fromVC;
        self.localPath = localPath;
    }
    return self;
}
- (void)show{
 
    UIVideoEditorController * videoEditor = [UIVideoEditorController new];
    videoEditor.view.backgroundColor = UIColor.whiteColor;
    videoEditor.videoMaximumDuration = maxDuringVideoTime;
    videoEditor.videoPath = self.localPath;
    videoEditor.delegate = self;
    [self.fromVC presentViewController:videoEditor animated:YES completion:nil];
}
- (void)videoEditorController:(UIVideoEditorController *)editor didSaveEditedVideoToPath:(NSString *)editedVideoPath{
    

    [self.fromVC dismissViewControllerAnimated:YES completion:nil];
    [SVProgressHUD showInfoWithStatus:@"编辑成功"];
    if (self.didEditHandle) {
        self.didEditHandle(editedVideoPath);
    }
    [self setDidEditHandle:nil];
}
@end
